﻿#ifndef BIZADD_H
#define BIZADD_H

#include "itemadd.h"
#include <QSqlTableModel>

namespace Ui {
class BizAdd;
}

class BizAdd : public ItemAdd
{
    Q_OBJECT

public:
    explicit BizAdd(QWidget *parent = 0);
    ~BizAdd();

    void closeEvent(QCloseEvent *);

    void loadOptions();
    bool saveIndex(const QString &contractor, const QString &name,
                   const QString &number, const QString &request,
                   const QString &remark);
    bool saveStuff(const QString &name, const QString &number,
                   const QString &remark);

    void updateView(const QString &uid);
    void reload();
    void genRecordFromStuff(int id,const QString &info);

private slots:
    void on_btn_submit_clicked();
    void on_btn_save_clicked();
    void on_contractor_currentTextChanged(const QString &text);

private:
    Ui::BizAdd *ui;

    QString info;
    QString stuffTable;

    bool saveOk;
    QPair<QString,QString> pair;
    QString _uid;
    int plan_id;

    QSqlTableModel *model;
};

#endif // BIZADD_H
